# == Class: ceph
#
# Ceph cluster management.
#
class ceph (
  $package_name = $::ceph::params::package_name,
  $osd_disks = {},
  $fsid,
  $monitor_hosts,
  $public_network,
  $cluster_network = undef,
  $manage_firewall = $::ceph::params::manage_firewall,
  $mon_port = $::ceph::params::mon_port,
  $auth_cluster_required = $::ceph::params::auth_cluster_required,
  $auth_service_required = $::ceph::params::auth_service_required,
  $auth_client_required = $::ceph::params::auth_client_required,
  $osd_journal_size = $::ceph::params::osd_journal_size,
  $filestore_xattr_use_omap = $::ceph::params::filestore_xattr_use_omap,
  $osd_pool_default_size = $::ceph::params::osd_pool_default_size,
  $osd_pool_default_min_size = $::ceph::params::osd_pool_default_min_size,
  $osd_pool_default_pg_num = $::ceph::params::osd_pool_default_pg_num,
  $osd_pool_default_pgp_num = $::ceph::params::osd_pool_default_pgp_num,
  $osd_crush_chooseleaf_type = $::ceph::params::osd_crush_chooseleaf_type,
  $admin_socket = undef,
  $log_file = undef,
  $rbd_cache = undef,
  $rbd_cache_size = undef,
  $rbd_cache_max_dirty = undef,
  $rbd_cache_target_dirty = undef,
  $rbd_cache_max_dirty_age = undef,
  $rbd_cache_writethrough_until_flush = undef,
  $rbd_concurrent_management_ops = undef,
  $admin_key,
  $mon_key,
  $authkeys = hiera_hash('ceph::authkeys'),
  $rbd_devices = hiera_hash('ceph::rbd_devices', {}),
) inherits ceph::params {

  class { '::ceph::install': } ->
  class { '::ceph::config': } ~>
  class { '::ceph::mon': } ->
  class { '::ceph::osd': }

  create_resources(ceph::host, $::ceph::monitor_hosts)
  create_resources(ceph::key, $authkeys, { before => Class['ceph::mon']})
  create_resources(ceph::rbd, $rbd_devices, { require => Class['ceph::osd']})
}
